package com.zheng.study.company.entity;

import com.zheng.study.base.bean.BaseEnumManager;

import javax.persistence.*;
import java.util.Date;

/**
 * 实体类 - 登录账号
 * ============================================================================
 * author : dzw
 * createDate:  2018-08-16 。
 * ============================================================================
 */
//@Entity
//@Table(name = "sys_admin")
public class Admin extends CompanyEntity {
	private static final long serialVersionUID = 5202203464272277631L;

	public static final BaseEnumManager.AccountEnum[] ACCOUNT_PASSWORD = new BaseEnumManager.AccountEnum[]{
			BaseEnumManager.AccountEnum.USERNAME,
			BaseEnumManager.AccountEnum.MOBILE,
			BaseEnumManager.AccountEnum.USERNAME
	};

	/**
	 *用户名
	 */
	private String username;
	/**
	 * 手机号
	 */
	private String userMobile;
	/**
	 * 邮箱
	 */
	private String userEmail;
	/**
	 * 微信openId
	 */
	private String openId;
	/**
	 * 密码
	 */
	private String password;
	/**
	 * 密码加密盐值
	 */
	private String salt;
	/**
	 * token加密凭证
	 */
	private String secret;
	/**
	 * 账号登录类型
	 */
	private BaseEnumManager.AccountEnum accountEnum;
	/**
	 * 用户账号类型
	 */
	private BaseEnumManager.AccountTypeEnum accountTypeEnum;
	/**
	 * 账号是否可用    0||null 禁用    1可用
	 */
	private Integer accountEnabled;
	/**
	 * happy
	 */
	private String happy;

	/**
	 * 最后一次登录时间
	 */
	private Date loginTime;
	/**
	 * 最后一次登录ip
	 */
	private String loginIp;
	/**
	 * 最后一次登录设备
	 */
	private String loginDevice;
	/**
	 * 最后一个openId
	 */
	private String lastOpenId;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getUserMobile() {
		return userMobile;
	}

	public void setUserMobile(String userMobile) {
		this.userMobile = userMobile;
	}

	public String getUserEmail() {
		return userEmail;
	}

	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	public String getSecret() {
		return secret;
	}

	public void setSecret(String secret) {
		this.secret = secret;
	}

	@Column(nullable = false)
	@Enumerated(EnumType.STRING)
	public BaseEnumManager.AccountEnum getAccountEnum() {
		return accountEnum;
	}

	public void setAccountEnum(BaseEnumManager.AccountEnum accountEnum) {
		this.accountEnum = accountEnum;
	}

	@Column(nullable = false)
	@Enumerated(EnumType.STRING)
	public BaseEnumManager.AccountTypeEnum getAccountTypeEnum() {
		return accountTypeEnum;
	}

	public void setAccountTypeEnum(BaseEnumManager.AccountTypeEnum accountTypeEnum) {
		this.accountTypeEnum = accountTypeEnum;
	}

	public Integer getAccountEnabled() {
		return accountEnabled;
	}

	public void setAccountEnabled(Integer accountEnabled) {
		this.accountEnabled = accountEnabled;
	}

	public Date getLoginTime() {
		return loginTime;
	}

	public void setLoginTime(Date loginTime) {
		this.loginTime = loginTime;
	}

	public String getLoginIp() {
		return loginIp;
	}

	public void setLoginIp(String loginIp) {
		this.loginIp = loginIp;
	}

	public String getLoginDevice() {
		return loginDevice;
	}

	public void setLoginDevice(String loginDevice) {
		this.loginDevice = loginDevice;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public String getLastOpenId() {
		return lastOpenId;
	}

	public void setLastOpenId(String lastOpenId) {
		this.lastOpenId = lastOpenId;
	}

	public String getHappy() {
		return happy;
	}

	public void setHappy(String happy) {
		this.happy = happy;
	}
}
